public class Person3 {
    private String name;
    private int age;
    private genderEnum sex;
    public Person3(String name, int age, genderEnum sex){
        this.name=name;
        this.age=age;
        this.sex=sex;
    }
    public void setName(String name){
        this.name=name;
    }
    public String getName(){
        return this.name;
    }
    public void setAge(int age){
        this.age=age;
    }
    public int getAge(){
        return this.age;
    }
    public void setSex(genderEnum sex){
        this.sex=sex;
    }
    public genderEnum getSex(){
        return this.sex;
    }
    public void play(Person3 person3){
        if(person3 instanceof Student3){
            Student3 student3=(Student3) person3;
            System.out.println("学生:"+student3.getName()+"爱玩足球");
        } else if (person3 instanceof Teacher3) {
            Teacher3 teacher3=(Teacher3) person3;
            System.out.println("老师:"+teacher3.getName()+"爱玩象棋");

        }else {
            System.out.println(this.getName()+"爱玩");
        }

    }
}
